﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="NewDefault.aspx.cs" Inherits="manager_task_NewDefault" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>发布任务</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <section class="content-header">
        <h1>任务相关
            <small>发布任务</small>
        </h1>
        <ol class="breadcrumb">
            <li><a><i class="fa fa-dashboard"></i>主页</a></li>
            <li><a href="userManager.aspx">任务相关</a></li>
            <li class="active">发布任务</li>
        </ol>
    </section>

    <section class="content">

        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">发布任务</h3>
            </div>
            <div class="box-header with-border">
                <div>
                    <div class="col-md-12">
                        <a data-toggle="modal" data-target="#moduleManager1" class="btn btn-success">发布任务</a>
                    </div>
                </div>
            </div>
            <div class="box-body">
                <table id="userManagerList" class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th></th>
                            <th>标题</th>
                            <th>发布</th>
                            <th>执行</th>
                            <th>得分</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="rptDeApply_1" runat="server">
                            <ItemTemplate>
                                <tr>
                                    <td><%# Eval("id") %></td>
                                    <td class="col-sm-6"><%# Eval("title") %></td>
                                    <td class="col-sm-1"><%# Eval("fb_username") %></td>
                                    <td class="col-sm-2"><%# Eval("zx_psid_mc") %>[<%# Eval("zx_psid_userName") %>]</td>
                                    <td class="col-sm-1"><%# Eval("Gp") %></td>
                                    <td class="col-sm-1"><%# SQ_Eval_Pub.GetTaskState(Eval("state").ToString()) %></td>
                                    <td class="col-sm-1"><a style="cursor: pointer;" href="NewDefaultAdd.aspx?taskid=<%# Eval("ID") %>">修改</a></td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
            <div class="modal fade" id="moduleManager" role="dialog" aria-labelledby="moduleManagerLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="userManagerLabel"></h4>
                            <asp:HiddenField ID="hidBID" runat="server" />
                        </div>
                        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <div style="display: none">
                                    <asp:Button ID="btnGet" runat="server" Text="Get" OnClick="btnGet_Click" />
                                </div>
                                <div class="modal-body">
                                    <table class="table table-bordered">
                                        <tr>
                                            <td class="col-sm-3">名称</td>
                                            <td>
                                                <asp:TextBox ID="txt_mc" CssClass="form-control" runat="server"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-3">类型</td>
                                            <td>
                                                <asp:DropDownList ID="dllType" CssClass="form-control" runat="server">
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>可用</td>
                                            <td>
                                                <asp:DropDownList ID="ddlIsUsing" CssClass="form-control" runat="server">
                                                    <asp:ListItem Value="1">可用</asp:ListItem>
                                                    <asp:ListItem Value="0">不可用</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <asp:Button ID="btnUpdate" runat="server" Text="保存" CssClass="btn btn-primary" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="moduleManager1" role="dialog" aria-labelledby="moduleManagerLabel">
                <div class="modal-dialog" role="document" style="width: 1000px">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">选择任务执行岗位(单击名称选择)</h4>
                        </div>
                        <div class="modal-body">
                            <ul class="nav nav-tabs" role="tablist">
                                <%=Html_Dept %>
                            </ul>
                            <div class="tab-content">
                                <%=Html_Dept_Detail %>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div style="display: none;">
            <input type="text" id="dept_id" runat="server" />
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptPlaceHolder" runat="Server">
    <script>
        $(document).ready(function () {
            var type = $("#ContentPlaceHolder_dept_id").val();
            var arr_dept = type.split("|");
            for (var i = 0; i < arr_dept.length; i++) {
                $("#table_" + arr_dept[i]).DataTable(
                               {
                                   "columnDefs": [
                                       { "targets": [0], "visible": false }
                                   ],
                                   "autoWidth": true,
                                   "ordering": false,
                                   "scroll": true,
                                   "language": {
                                       "url": "/reference/plugins/datatables/Chinese.json"
                                   }
                               });
            }
            var type = $("#ContentPlaceHolder_type_value").val();
        });

        $(document).ready(function () {
            $("#userManagerList").DataTable(
                {
                    "columnDefs": [
                        { "targets": [0], "visible": false }
                    ],
                    "autoWidth": true,
                    "ordering": false,
                    "scroll": true,
                    "language": {
                        "url": "/reference/plugins/datatables/Chinese.json"
                    }
                });
        });

        $('#moduleManager').on('show.bs.modal', function (event) {
            var button = $(event.relatedTarget)
            $("#ContentPlaceHolder_hidBID").val("");
            var action = button.data('action');
            if (action == "update") {
                var browserID = button.data('bid');

                $("#userManagerLabel").text("修改模板");



                $("#ContentPlaceHolder_hidBID").val(browserID);
                $("#ContentPlaceHolder_btnGet").click();
            }
            else if (action == "add") {
                $("#userManagerLabel").text("新增模板");
            }

        })

        function SetZxGw(id, mc, type) {
            $('#moduleManager1').modal('hide');
            window.location = "NewDefaultAdd.aspx?title=" + mc + "&id=" + id + "&type=" + type + "&taskid=0";
        }



    </script>
</asp:Content>


